home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c
- Subject: Re: time/date algorithms
- Date: Fri, 05 Jan 96 02:23:43 GMT
- Organization: none
- Message-ID: <820808623snz@genesis.demon.co.uk>
- References: <30EC5A1F.3DE0@sandpoint.com>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <30EC5A1F.3DE0@sandpoint.com>
- mark_thomas@sandpoint.com "Mark Thomas" writes:
-
- >A co-worker of mine is looking for an algorithm what
- >works something like this: given a week number 1-52
- >(or 0-51 I suppose) and a year, the month and day of the
- >sunday in that week is output. He swears he's seen
- >it in a book, and doesn't want to have to re-create it.
-
- First you have to define what you mean by a week number. There are many
- definitions to choose from. For example there are 2 defined by the ANSI
- strftime %U and %W conversion specifiers, there are ISO 8601 week numbers
- and there might also be simpler definitions such at the first 7 days of
- the year being in week 1, and so on. It is probably simplest if your
- co-worker defines what he understands by week number.
-
- Incidentally 52 weeks only accounts for 364 days so there are more than 52
- weeks in a year.
-
- >Anyone have this [bizarre] algorithm laying around somewhere,
- >or know where it can be found? Please reply by email
- >if you do -- thanks alot.
-
- No I don't! :-) However it should be very easy to write once we know
- what precisely your co-worker needs.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-